-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.5] Eloquent model without updated_at field #21178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need nested conditional statement when &&
could be used?
if (static::UPDATED_AT !== null && ! $this->isDirty(static::UPDATED_AT)) {
$this->setUpdatedAt($time);
}
This was proposed in #20930 and rejected. Just referencing. |
@taylorotwell thanks! |
This will conflict with framework/src/Illuminate/Database/Eloquent/SoftDeletes.php Lines 69 to 72 in 5bd7c77
It should also be supported there. |
setting |
@segadora thank you for spotting this! @salarmehr many are using null for UPDATED_AT, so maybe empty check could cover both cases (otherwise it's a breaking change), you might try to file a PR for letting use false too. I do agree false might feel a bit more natural. |
@segadora Thanks for your comment. My comment mainly refers to the defect of the Model class itself. |
@linaspasv As I remember I've tried to change this value to false and got same result. |
@linaspasv I will agree with a empty check. |
Unfortunately, I've got a legacy table that does have an Looks like I'll need to turn off timestamps entirely and manage the update time myself in 5.5 |
@pdbreen it would be better to turn off timestamps for such case and manage them manually as you proposed. |
Since Laravel 5.0 many found a simple method to have eloquent models without updated_at field. Unfortunatelly this is not a thing in Laravel 5.5 anymore ( #19627 #21045 #20901 #20930 ...)
e.g. how it was used before Laravel 5.5
I do understand it's not an official method but since we do lack flexibility on the subject, please, leave this behaviour as it was working before...